﻿

using System.Collections.Generic;

namespace LxCFD
{
    public class FvThread : FvThreadBase
    {
        public FvThread(FvZone ownerZone)
        {
            this.RootZone = ownerZone;
        }
        #region 几何信息
        public FvZone RootZone;
        public FvContact RootContact;

        #endregion
        #region 物理模型设置
        public bool IsEnableCoupled
        {
            get
            {
                if (RootContact != null)
                {
                    return RootContact.IsEnabled;
                }
                else
                {
                    return false;
                }
            }
            set
            {
                if (RootContact == null) return;
                RootContact.IsEnabled = value;
            }
        }
        public static List<BoundaryTypes> SolidBoundTypes = new List<BoundaryTypes>()
            {
                BoundaryTypes.SolidWall
            };
        public static List<BoundaryTypes> FluidBoundTypes = new List<BoundaryTypes>()
            {
                BoundaryTypes.FluidWall,
                BoundaryTypes.VelocityInlet,
                BoundaryTypes.PressureInOut,
                BoundaryTypes.Symmetry,
            };
        public void CheckSetBoundarys()
        {
            if (RootZone.PhysicalModel == null) return;
            switch (RootZone.PhysicalModel.PhysicalType)
            {
                case PhysicalTypes.Solid:
                    if (!SolidBoundTypes.Contains(BoundaryType))
                    {
                        BoundaryType = BoundaryTypes.SolidWall;
                    }
                    break;
                case PhysicalTypes.Fluid:
                    if (IsEnableCoupled)
                    {
                        BoundaryType = BoundaryTypes.FluidWall;
                    }
                    else
                    {
                        if (!FluidBoundTypes.Contains(BoundaryType))
                        {
                            BoundaryType = BoundaryTypes.FluidWall;
                        }
                    }
                    break;
                default:
                    break;
            }
        }


        public BoundaryTypes BoundaryType { get => _boundaryType; set { _boundaryType = value; } }
        private BoundaryTypes _boundaryType;

        public WallThermalTypes WallThermalType { get => _wallThermalType; set { _wallThermalType = value; } }
        private WallThermalTypes _wallThermalType = WallThermalTypes.FixHeatFlux;
        public Value1Base<double> Temperature { get => _T; set { _T = value; } }
        private Value1Base<double> _T = new Value1Const.Double(300);
        public Value1Base<double> HeatFlux { get => _heatFlux; set { _heatFlux = value; } }
        private Value1Base<double> _heatFlux = new Value1Const.Double(0);
        public Value1Base<double> Coupledh { get => _coupledh; set { _coupledh = value; } }
        private Value1Base<double> _coupledh = new Value1Const.Double(0);
        public Value1Base<double> CoupledT { get => _coupledT; set { _coupledT = value; } }
        private Value1Base<double> _coupledT = new Value1Const.Double(300);
        public bool IsNoSlipingWall { get => _isNoSliping; set { _isNoSliping = value; } }
        private bool _isNoSliping = true;
        public bool IsStaticWall { get => _isStaticWall; set { _isStaticWall = value; } }
        private bool _isStaticWall = true;
        public Value1Base<Vector3d> Velocity { get => _Velocity; set => _Velocity = value; }
        private Value1Base<Vector3d> _Velocity = new Value1Const.Vector(new Vector3d());

        public bool IsNormalToBound { get => _isNormalToBound; set { _isNormalToBound = value; } }
        private bool _isNormalToBound = true;
        public Value1Base<double> VelocityMagnitude { get => _VelocityMod; set { _VelocityMod = value; } }
        private Value1Base<double> _VelocityMod = new Value1Const.Double(0);
        public Value1Base<double> Pressure { get => _Pressure; set { _Pressure = value; } }
        private Value1Base<double> _Pressure = new Value1Const.Double(0);
        #endregion


    }
}
//#region  头
//public string name { get => _name; set { _name = value; } }
//private string _name;
//public int ID { get => _ID; set { _ID = value; } }
//private int _ID;
//#endregion